package com.godofgamblers.hotelmanagementsystem.handler;

import com.godofgamblers.hotelmanagementsystem.dto.RoomsInfoDto;
import com.godofgamblers.hotelmanagementsystem.dto.TodaySummaryDto;
import com.godofgamblers.hotelmanagementsystem.pojo.CheckInfo;
import com.godofgamblers.hotelmanagementsystem.pojo.MoneyOfMonth;
import com.godofgamblers.hotelmanagementsystem.pojo.UserLevel;
import com.godofgamblers.hotelmanagementsystem.service.BusinessReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


import java.util.List;

/*

@author huanglang

@create_time 2019-10-15 11:40

Nothing is difficult but bugs

    处理营业查询请求
*/
@Controller
@RequestMapping("business")
public class BusinessReportHandler {
    @Autowired
    private BusinessReportService businessReportService;

    //获取营业查询每日信息的数据
    @RequestMapping("today_summary")
    @ResponseBody
    public TodaySummaryDto todaySummary(String today) {
        TodaySummaryDto dto = businessReportService.getTodaySummaryDto(today);
        return dto;
    }

    //获取营业查询房间的数据
    @RequestMapping("rooms_data")
    @ResponseBody
    public RoomsInfoDto roomsInfo(String month) {
        RoomsInfoDto dto = businessReportService.getRoomsInfoDto(month);
        return dto;
    }

    //获取营业查询入住信息的数据
    @RequestMapping("check_info")
    @ResponseBody
    public List<CheckInfo> checkInfo(String searchType, String context) {
        List<CheckInfo> checkInfos = businessReportService.getCheckInfos(searchType,context);
        return checkInfos;
    }

    //获取营业查询用户的数据
    @RequestMapping("user_data")
    @ResponseBody
    public List<UserLevel> userData() {
        List<UserLevel> userCount = businessReportService.getUserCount();
        return userCount;
    }

    //获取营业查询每年的数据
    @RequestMapping("year_summary")
    @ResponseBody
    public List<MoneyOfMonth> yearSummary(String year) {
        List<MoneyOfMonth> moneyOfMonth = businessReportService.getYearMoneyCount(year);
        return moneyOfMonth;
    }


}
